package com.hx.strategy.pay.payport;

import com.hx.strategy.pay.MsgRes;

import java.math.BigDecimal;

/**
 * @author Huathy
 * @date 2021-08-31 21:37
 * @description
 */
public abstract class Payment {
    public abstract String getNmae();

    protected abstract BigDecimal queryBalance(String uid);

    public MsgRes pay(String uid, BigDecimal amount){
        if(queryBalance(uid).compareTo(amount) == -1){
            return new MsgRes(500,"支付失败","余额不足");
        }
        return new MsgRes(200,"支付成功","金额：" + amount);
    }
}

